package com.example.springbootwebfluxdemo.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.example.springbootwebfluxdemo.mapper.ClickurlMapper;
import com.example.springbootwebfluxdemo.pojo.Clickurl;
import com.example.springbootwebfluxdemo.service.ClickurlService;
import com.example.springbootwebfluxdemo.util.RequestIpUtil;
import org.springframework.stereotype.Service;
import org.springframework.web.reactive.function.server.ServerRequest;

import java.util.Date;

/**
* @author 78500
* @description 针对表【clickurl】的数据库操作Service实现
* @createDate 2022-09-13 09:26:55
*/
@Service
public class ClickurlServiceImpl extends ServiceImpl<ClickurlMapper, Clickurl>
    implements ClickurlService {

    @Override
    public void saveClick(ServerRequest request) {
        String userIp = RequestIpUtil.getUserIp(request);
        Clickurl clickurl = new Clickurl();
        clickurl.setCreatedate(new Date());
        clickurl.setIp(userIp);
        this.save(clickurl);
    }
}




